package me.zk.easyexcel.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author zhangkai
 * @date 2023/7/8 00:12
 */
@Aspect
@Component
public class ExcelImportAop {

    @Around("@annotation(org.springframework.web.bind.annotation.GetMapping)")
    public Object around(ProceedingJoinPoint pjb) {
        Long startTime = System.currentTimeMillis();
        Object obj = null;
        try {
            obj = pjb.proceed();
        } catch ( Throwable t) {
            throw new RuntimeException(t.getMessage());
        }
        Long endTime = System.currentTimeMillis();
        System.out.println("耗时：" + (endTime - startTime));
        return obj;
    }
}
